# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=schroedinger

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.11
pkgrel=2
pkgdesc="An implemenation of the Dirac video codec in ANSI C code (mingw-w64)"
arch=('any')
url="http://www.diracvideo.org/"
license=('GPL2' 'LGPL2.1' 'MPL' 'MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-orc")
options=('strip' 'staticlibs')
source=("http://www.diracvideo.org/download/schroedinger/${_realname}-${pkgver}.tar.gz"
    0001-builddir-not-srcdir.all.patch
    0002-link-testsuite-to-orc-tmp.mingw.patch)
md5sums=('da6af08e564ca1157348fb8d92efc891'
         '2a98d3929c8e4106768d437cc0ce58fb'
         'e073b0580ca3e8171a2266aa529472bd')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i ${srcdir}/0001-builddir-not-srcdir.all.patch
  patch -p1 -i ${srcdir}/0002-link-testsuite-to-orc-tmp.mingw.patch
  autoreconf -fi
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --with-opengl=${MINGW_PREFIX}
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
